﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace test
{
    //生成随机时间
    class OccurredTime
    {
        string tempTime = string.Empty;
        public string GetTime
        {
            get {
                    string tempStr = string.Empty;
                    Random random = new Random(~unchecked((int)(DateTime.Now.Ticks)));
                    int hour = random.Next(0, 9);//设置0点到9点的随机小时
                    int minute = random.Next(0, 60);//设置随机分钟
                    int second = random.Next(0, 60);//设置随机秒钟
                    tempStr = string.Format("{0} {1}:{2}:{3}", DateTime.Now.AddDays(1).ToString("yyyy-MM-dd"), hour, minute, second);
                    return tempStr;
            }
        }
    }
}
